<template>
  <div>
    <div>注册或移除路由</div>

    <RouterView/>
  </div>
</template>

<script>
import {defineComponent} from 'vue';

export default defineComponent({
  name: 'AddRemoveRouteChildren',
  watch: {
    $router: {
      immediate: true,
      deep: true,
      handler(to, from) {
        console.log('监听到路由变化', to);
      }
    }
  },
  created() {
    this.$watch(
      () => this.$route.params,
      (to, from) => {
        console.log('监听到路由Params变化');
      }
    );
  },
});
</script>

<style scoped>

</style>